import request  from "../request.js"

const Api = {
    page: '/admin/order/page?',
    delete: '/admin/order/delete/id=',
    editOrSave: '/admin/order/update',
    orderIdL: '/admin/order-id=',
    editOrSave: '/admin/order/update',
    batch: '/admin/order/batchd_delete'
}


/**
 * 分页获取订单信息
 * @param object 查询参数
 * @return {AxiosPromise}
 */
export function getPageOrder(param){
    return request({
        url: Api.page,
        method: 'GET',
        params: param
    })
}

/**
 * 根据id删除订单信息
 * @param id int 订单id
 * @return {AxiosPromise}
 */
export function deleteOrderById(id) {
    return request({
        url: Api.delete+id,
        method: 'GET'
    })
}

/**
 * 批量删除商品信息
 * @ids  array id数组0
 * @return {AxiosPromise}
 */
export function batchDeleteOrderInfo(ids){
    return request({
        url: Api.batch,
        method: 'post',
        data: ids
    })
}

/**
 * 修改或保存订单信息
 * @orderinfo  object 订单信息
 * @return {AxiosPromise}
 */
export function editOrSaveOrderInfo(orderinfo){
    return request({
        url: Api.editOrSave,
        method: 'post',
        data: orderinfo
    })
}